//package com.lzx.security.service;
//
//import com.lzx.security.custom.CustomUser;
//import com.lzx.security.entity.UserVO;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import java.util.Collections;
//import java.util.Objects;
//
//@Component
//public class UserDetailsServiceImpl implements UserDetailsService {
//    @Resource
//    private UserService userService;
//
//    @Override
//    public UserDetails loadUserByUsername(String mobile) throws UsernameNotFoundException {
//        UserVO userVO = userService.getUserInfoByUserName(mobile);
//        if(userVO == null) {
//            throw new UsernameNotFoundException("用户不存在");
//        }
//        if(Objects.equals(userVO.getStatus(), "1")) {
//            throw new RuntimeException("用户已被禁用");
//        }
//        return new CustomUser(userVO, Collections.emptyList());
//    }
//}